package com.example.covid19.mapper;

import com.example.covid19.common.Dto.Ckdeto2;
import com.example.covid19.common.Dto.Cra_coll;
import com.example.covid19.entity.Cravate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author BaiZhengChun
 * @since 2023-03-07
 */
public interface CravateMapper extends BaseMapper<Cravate> {
    @Select("SELECT " +
            " cravate.xid,  " +
            " cravate.rname,  " +
            " college.cname " +
            "FROM " +
            " cravate " +
            " INNER JOIN " +
            " college " +
            " ON " +
            "  cravate.cid = college.cid")
    List<Cra_coll> getccol();
    @Select("SELECT " +
            " majeur.majeurname, " +
            " classes.clname " +
            " FROM " +
            " college " +
            " LEFT JOIN " +
            " cravate " +
            " ON " +
            " college.cid = cravate.cid " +
            " LEFT JOIN " +
            " majeur " +
            " ON " +
            " cravate.xid = majeur.xid " +
            " LEFT JOIN " +
            " classes " +
            " ON " +
            " majeur.mid = classes.mid " +
            "WHERE " +
            " cravate.xid = #{id} ")
    List<Ckdeto2> candelete(@Param("id")Integer id);

}
